package com.modules.flexnet.model
{
	import com.modules.flexnet.model.domain.LoadedDataModel;
	import com.modules.flexnet.model.domain.ProductModel;
	import com.modules.flexnet.model.domain.SettingsModel;
	import com.modules.flexnet.model.domain.ViewModel;
	import com.modules.flexnet.model.presentation.PresentationModel;
	
	
	
	public class ModuleModelLocator
	{	
		//DOMAIN MODEL
		[Bindable]
		public var settingsModel:SettingsModel;
		[Bindable]
		public var productModel:ProductModel;
		[Bindable]
		public var loadedDataModel:LoadedDataModel;
		[Bindable]
		public var viewModel:ViewModel;
		//PRESENTATION MODEL
		[Bindable]
		public var presentationModel:PresentationModel;
		
		
		public function ModuleModelLocator()
		{
			if(__instance!=null) throw new Error("Error: Singletons can only be instantiated via getInstance() method!");
			ModuleModelLocator.__instance = this;
		}
		static private var __instance : ModuleModelLocator = null;
		static public function getInstance() : ModuleModelLocator
		{

			if(__instance == null)
			{
				__instance = new ModuleModelLocator();
				__instance.settingsModel = new SettingsModel();
				__instance.productModel = new ProductModel();
				__instance.loadedDataModel = new LoadedDataModel();
				__instance.viewModel = new ViewModel();
				__instance.presentationModel = new PresentationModel(__instance);
			}

			return __instance;
		}
	}
}
